﻿


using System;
using System.Text;
using System.Collections;
using System.Xml;
using System.Data;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Resources;
using System.Reflection;
using System.Globalization;
using System.Threading;

using Telerik.WebControls;
using UFSoft.UBF.UI.WebControls;
using UFSoft.UBF.UI.WebControls.InterActionComponenet;
using UFSoft.UBF.Util.Log;
using UFSoft.UBF.Util.Context;

//using MagicAjax.UI.Controls;
using UFSoft.UBF.Report.UI.ReportView.Web;
using UFSoft.UBF.UI.WebControlAdapter;
using UFSoft.UBF.UI.FormProcess;
using UFSoft.UBF.UI.IView;
using UFSoft.UBF.UI.Engine;
using UFSoft.UBF.UI.Engine.Builder;
using UFSoft.UBF.UI.Engine.Authorization;
using UFSoft.UBF.UI.MD.Runtime;
using UFSoft.UBF.UI.ActionProcess;
using UFSoft.UBF.UI.ControlModel;
using UFSoft.UBF.UI.Controls;
using UFSoft.UBF.UI.WebControls.Association;
using UFSoft.UBF.UI.WebControls.ClientCallBack;
using System.Web.UI;
using UFSoft.UBF.UI.UIFormPersonalization;
using System.Collections.Specialized;


/***********************************************************************************************
 * Form ID:d0a80516-82ef-490b-af78-832199180e39 
 * Form Name:DeliveryTORcvUIForm
 * UIFactory Auto Generator
 ***********************************************************************************************/
namespace DeliveryTORcvUIModel
{
	[FormRegister("UFIDA.U9.Cust.U9Demo.DeliverUI","DeliveryTORcvUIModel.DeliveryTORcvUIFormWebPart", "UFIDA.U9.Cust.U9Demo.DeliverUI.WebPart", "d0a80516-82ef-490b-af78-832199180e39","WebPart", "False", 992, 504)] 
	///insert into aspnet_Parts (SysVersion, Path, ClassName, [Assembly], FormId) values (0, 'UFIDA.U9.Cust.U9Demo.DeliverUI', 'DeliveryTORcvUIModel.DeliveryTORcvUIFormWebPart', 'UFIDA.U9.Cust.U9Demo.DeliverUI.WebPart', 'd0a80516-82ef-490b-af78-832199180e39')
	///<siteMapNode url="~/erp/simple.aspx?lnk=d0a80516-82ef-490b-af78-832199180e39" title="DeliveryTORcvUIForm"/>
    public partial class DeliveryTORcvUIFormWebPart : UFSoft.UBF.UI.FormProcess.BaseWebForm
    {
		#region Page Controller/Code Behind
        private static readonly ILogger logger = LoggerManager.GetLogger(typeof(DeliveryTORcvUIFormWebPart));
        private string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName;
        //private string displayNamePostfix = "displayName";

		#region 强类型化基类属性.
		public new DeliveryTORcvUIModelAction Action
		{
			get { return (DeliveryTORcvUIModelAction)base.Action; }
			set { base.Action = value; }
		}
		DeliveryTORcvUIModelModel _uimodel=null;
		public new DeliveryTORcvUIModelModel Model
		{
			get 
			{
			     if(_uimodel == null){
			          _uimodel = new DeliveryTORcvUIModelModel();
			     }
			     return _uimodel; 
			}
			set { _uimodel = value; }
		}
        protected override IUIModel UIModel{
            get{
                return this.Model;
            }
            set{
                this.Model = value as DeliveryTORcvUIModelModel;
            }
        }
		#endregion 
		public FormAdjust adjust;
        #region variable declaration
        IUFCard Card0;
        IUFDataGrid DataGrid0;
        IUFCard Card1;
        IUFButton OnOK1303;
        IUFButton OnCancel474;
		UpdatePanel updatePanel;
		HiddenField wpFindID;
		IUFContainer topLevelPanel;     
        IUFSeparator SeparatorInFavorites;
        IUFButton BtnDefaultValues;
        #endregion
        
        #region constructor
        public DeliveryTORcvUIFormWebPart()
        {
            FormID = "d0a80516-82ef-490b-af78-832199180e39";
            IsAutoSize = bool.Parse("True");
        }
        #endregion


	
            
	//获取档案版型结果: 

        #region eventBind and databind
        private void EventBind()
        {
			//事件绑定模板
				//Button控件事件
			this.OnOK1303.Click += new EventHandler(OnOK1303_Click);		
						
				//Button控件事件
			this.OnCancel474.Click += new EventHandler(OnCancel474_Click);		
						

	
			//Grid控件的分页事件				
			((UFWebDataGridAdapter)this.DataGrid0).GridMakePageEventHandler += new GridMakePageDelegate(UFGridDataGrid0_GridMakePageEventHandler);
             //Grid控件的客户化筛选，定位事件
            ((UFWebDataGridAdapter)this.DataGrid0).GridCustomFilterHandler += new GridCustomFilterDelegate(UFGridDataGrid0_GridCustomFilterHandler);

            AfterEventBind();
        }
        #endregion            
        
		#region override method
		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad2(e);
		}
		protected override void OnLoadDataDo(EventArgs e)
		{
		    adjust.ProcessAdjustBeforeOnLoad(this);
			if (UIEngineHelper.IsDataBind(PageStatus, this))
			{
				if(this.Model==null){				        
					this.Model = new DeliveryTORcvUIModelModel();
				}
				OnLoadConsumer(new InParameterModel[]{},new InParameterModel[]{});
				OnLoadData(this);
				this.IsDataBinding = true ; //加载完数据要绑定一次.目前加这.
			}
			else
			{
				//去除.已经移入到OnInit()中.
				//this.Model = (DeliveryTORcvUIModelModel)this.CurrentState[this.TaskId.ToString()];
			}
			adjust.ProcessAdjustAfterOnLoadData(this);
		            AfterOnLoad();
            
            adjust.ProcessAdjustAfterOnLoad(this);
		}
		protected override void OnPreRender(EventArgs e)
		{
			base.OnPreRender2(e);
		}
        protected override void OnPreRenderDo(EventArgs e)
        {
            adjust.ProcessAdjustBeforeOnPreRender(this);
			base.OnPreRender(e);
			this.CurrentState[this.TaskId.ToString()] = this.Model;
			RegisterClearWebPartPadding();
            UFIDA.U9.UI.PDHelper.FormAuthorityHelper.SetWebPartAuthorization(this);
            
			if (IsDataBinding) //2006-9-7 可由开发人员控制
			{
				BeforeUIModelBinding();
								if(!Page.IsPostBack)
				{
					EnumTypeBinding.BindEnumControls(this);
				}
				UFIDA.U9.UI.Commands.CommandHelper.BindFlexData(this);
				adjust.ProcessAdjustBeforeDataBinding(this);
				if (this.IsOnlyDataBinding)
				{
					this.DataBinding();
				}
				adjust.ProcessAdjustAfterDataBinding(this);

				AfterUIModelBinding();
			}
			adjust.ProcessAdjustAfterOnPreRender(this);
        }
		protected override void OnInit(EventArgs e)
		{
			base.OnInit2(e);
		}
		protected override void OnInitDo(EventArgs e)
		{			 
			this.Page.InitComplete += new EventHandler(Page_InitComplete);
			WebPartBuilder.InitWebPart(this);
            this.Action = new DeliveryTORcvUIModelAction(this);
            adjust = new FormAdjust();
		    CreateFormChildControls();
		}
        void Page_InitComplete(object sender, EventArgs e)
        {

            adjust.ProcessInit(this);
        }
        #endregion

      
        
        #endregion

	
		/// <summary>
        /// WebPart View
        /// </summary>
        #region view Create Contorls
        private void CreateFormChildControls()
        {
            IUFContainer _panel = UIControlBuilder.BuildTopLevelContainer(this,"DeliveryTORcvUIForm",true,992,504);
            CommonBuilder.ContainerGridLayoutPropBuilder(_panel, 1, 2, 0, 10, 10, 10, 10, 10);
			InitViewBindingContainer(this, _panel,  null, "", "", null, 1, "");
			UIControlBuilder.BuildContainerGridLayout(_panel, 10,new GridColumnDef[]{new GridColumnDef(972,bool.Parse("False")),},new GridRowDef[]{new GridRowDef(448,bool.Parse("False")),new GridRowDef(25,bool.Parse("True")),});
            //???还有用么?
            topLevelPanel = _panel;    
            
            UIControlBuilder.BuildCommonControls(this,ref updatePanel,ref wpFindID);
            





	
			_BuilderControl_Card0(_panel);

		
			UIControlBuilder.BuilderUFControl(this.Card0, "1");		


	
			_BuilderControl_Card1(_panel);

		
			UIControlBuilder.BuilderUFControl(this.Card1, "2");		



		
     
			
			
            EventBind();
            AfterCreateChildControls();
            
        }        







	                   
        private IUFCard _BuilderControl_Card0(IUFContainer container)
        {
            IUFCard _UFCard = UIControlBuilder.BuildCard(container,"Card0",false,"none", true, true, "1","","c5e1f07a-8319-4744-960b-30606f8b7225");
			CommonBuilder.GridLayoutPropBuilder(container, _UFCard, 972, 448, 0, 0, 1, 1, "100");
            CommonBuilder.ContainerGridLayoutPropBuilder(_UFCard, 1, 1, 0, 5, 0, 0, 0, 0);
			InitViewBindingContainer(this, _UFCard,  null, "", "", null, 1, "");
			UIControlBuilder.BuildContainerGridLayout(_UFCard, 5,new GridColumnDef[]{new GridColumnDef(972,bool.Parse("False")),},new GridRowDef[]{new GridRowDef(448,bool.Parse("False")),});
            this.Card0 = _UFCard;

            ///foreach UFCard下的所有控件，增加到此容器





	
			_BuilderControl_DataGrid0(_UFCard);

		
			UIControlBuilder.BuilderUFControl(this.DataGrid0, "0");		



	

            
            container.Controls.Add(_UFCard);
            return _UFCard;
        }

				





       
        private void _BuilderControl_DataGrid0(IUFContainer container)
        {
            IUFDataGrid _UFGrid = UIControlBuilder.BuildGridControl("DataGrid0", UFSoft.UBF.UI.ControlModel.EditStatus.Edit, true, true,true,true,false,true,50,true, false) ;
  			UIControlBuilder.BuilderUFControl(_UFGrid, "True", "True", "0");
			CommonBuilder.GridLayoutPropBuilder(container, _UFGrid, 972, 448, 0, 0, 1, 1, "100");
			InitViewBindingContainer(this, _UFGrid,  this.Model.DeliveryLine, "DeliveryLine", "", null, 50, "送货单行");
			((UFSoft.UBF.UI.WebControlAdapter.UFWebDataGridAdapter)_UFGrid).PagingStrategy=UFSoft.UBF.UI.ControlModel.GridPagingStrategy.Auto;
			_UFGrid.AllowSelectAllPage=false;
			((UFSoft.UBF.UI.WebControls.UFGrid)_UFGrid).IsSumAllData=false;
		        ((UFSoft.UBF.UI.WebControls.UFGrid)_UFGrid).IsSumSelectedData=false;
            this.DataGrid0 = _UFGrid;
            container.Controls.Add(_UFGrid);



			IUFDataGridColumn column ;
			GridColumn gridColumn ;
	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"ID0","NumberColumnModel", "", 0,this.Model.DeliveryLine.Fields["ID"]/*ID*/,"ID", true, false, true, false, false, false, 7, 100, "19.0",true, false,"","015bd81b-ca05-4a80-a6a1-d4c0da85110b","015bd81b-ca05-4a80-a6a1-d4c0da85110b","4e0acc37-cba8-461a-bf20-8e73ce2d6aa5");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"SysVersion0","NumberColumnModel", "", 0,this.Model.DeliveryLine.Fields["SysVersion"]/*SysVersion*/,"SysVersion", false, false, true, false, false, true, 7, 100, "19.0",true, false,"0","5d51c880-3b5b-4c5a-841c-8769f0862ed6","5d51c880-3b5b-4c5a-841c-8769f0862ed6","052768df-e25a-41da-a2f2-90c5e79328ce");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"DocLineNo0","NumberColumnModel", "", 0,this.Model.DeliveryLine.Fields["DocLineNo"]/*DocLineNo*/,"DocLineNo", false, true, false, false, false, false, 2, 100, "10.0",true, false,"0","1e7977df-8f3f-4a82-893b-c4154329fdf3","1e7977df-8f3f-4a82-893b-c4154329fdf3","64bd176d-16d4-446c-b742-2f1e49300056");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Item_Code0","TextBoxColumnModel", "", 0,this.Model.DeliveryLine.Fields["Item_Code"]/*Item_Code*/,"Item_Code", false, true, false, false, false, true, 0, 100, "255",true, false,"","2d5971ad-5fcd-4e6f-8465-c20082a183cb","2d5971ad-5fcd-4e6f-8465-c20082a183cb","0ba91b34-f649-45d0-9dc0-0574eeae0f3f");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Left, false,"",false,"1","1","255") ;          
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Item_Name0","TextBoxColumnModel", "", 0,this.Model.DeliveryLine.Fields["Item_Name"]/*Item_Name*/,"Item_Name", false, true, false, false, false, false, 0, 100, "255",true, false,"","6a9274d9-aafb-43b7-973c-a6d2d56ccf9e","6a9274d9-aafb-43b7-973c-a6d2d56ccf9e","739721a8-a949-4b2c-a4b7-4ab819dfbef9");
         
			GridControlBuilder.GridTextBoxColumnBuilder((IUFTextBoxColumn)column,"",TextAlign.Left, false,"",false,"1","1","255") ;          
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"Qty0","NumberColumnModel", "", 2,this.Model.DeliveryLine.Fields["Qty"]/*Qty*/,"Qty", false, true, false, false, false, true, 8, 100, "24.9",true, false,"0","5d7ec096-ebac-4da9-97e2-de6a997a63cc","5d7ec096-ebac-4da9-97e2-de6a997a63cc","6644f5da-0a3e-4895-bb47-3d7c125ecfcb");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"ToQty0","NumberColumnModel", "", 2,this.Model.DeliveryLine.Fields["ToQty"]/*ToQty*/,"ToQty", false, true, true, false, false, true, 8, 100, "18.0",true, false,"","9576d278-e47a-499f-b222-a2c2735ae26f","9576d278-e47a-499f-b222-a2c2735ae26f","e6376ac6-26e8-4b68-90a1-c07c009f02f9");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"ArrivedQty0","NumberColumnModel", "", 2,this.Model.DeliveryLine.Fields["ArrivedQty"]/*ArrivedQty*/,"ArrivedQty", false, true, false, false, false, true, 8, 100, "24.9",true, false,"0","85dc0520-2583-4aad-a72e-b1dcaf906160","85dc0520-2583-4aad-a72e-b1dcaf906160","9eefe01e-6e80-4365-a265-1c737568f365");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 	                     
			column = GridControlBuilder.GridColumnBuilder(_UFGrid,"RcvQty0","NumberColumnModel", "", 2,this.Model.DeliveryLine.Fields["RcvQty"]/*RcvQty*/,"RcvQty", false, true, false, false, false, true, 8, 100, "24.9",true, false,"0","b696564b-b3eb-4f3e-bae5-b14ca5c8a7cc","b696564b-b3eb-4f3e-bae5-b14ca5c8a7cc","0470de73-8613-4de6-b278-7c06d3513a7b");
			GridControlBuilder.GridNumberColumnBuilder((IUFNumberColumn)column, NumbericType.Numberic, 79228162514264337593543950335m, -79228162514264337593543950335m, null, null, null, null
			,true,"",false,"1","1");
	  
		 
        }

	                   
        private IUFCard _BuilderControl_Card1(IUFContainer container)
        {
            IUFCard _UFCard = UIControlBuilder.BuildCard(container,"Card1",false,"FunctionBar", true, true, "2","","cc9578b1-9a43-4de2-8245-375a58eb04a0");
			CommonBuilder.GridLayoutPropBuilder(container, _UFCard, 972, 25, 0, 1, 1, 1, "100");
            CommonBuilder.ContainerGridLayoutPropBuilder(_UFCard, 20, 1, 0, 0, 0, 0, 10, 0);
			InitViewBindingContainer(this, _UFCard,  null, "", "", null, 1, "");
			UIControlBuilder.BuildContainerGridLayout(_UFCard, 0,new GridColumnDef[]{new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(60,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(30,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(10,bool.Parse("True")),new GridColumnDef(80,bool.Parse("True")),new GridColumnDef(1,bool.Parse("True")),},new GridRowDef[]{new GridRowDef(20,bool.Parse("True")),});
            this.Card1 = _UFCard;

            ///foreach UFCard下的所有控件，增加到此容器





				this.OnOK1303 = UIControlBuilder.BuilderUFButton(_UFCard, true, "OnOK1303", true, true, 80, 20, 16, 0, 1, 1, "100","", this.Model.ElementID,"OnOK",false,"423519bc-b98e-405f-ad37-22c4853b2373","423519bc-b98e-405f-ad37-22c4853b2373","829fe680-86d3-42f5-bb00-254e3101f445");
	

		
			UIControlBuilder.BuilderUFControl(this.OnOK1303, "0");		


				this.OnCancel474 = UIControlBuilder.BuilderUFButton(_UFCard, true, "OnCancel474", true, true, 80, 20, 18, 0, 1, 1, "100","", this.Model.ElementID,"OnCancel",false,"71af30dd-b1eb-45f6-85e4-9f4bb4626935","71af30dd-b1eb-45f6-85e4-9f4bb4626935","d803886c-096c-4758-8a54-8dd72ff09d83");
	

		
			UIControlBuilder.BuilderUFControl(this.OnCancel474, "1");		



		

            
            container.Controls.Add(_UFCard);
            return _UFCard;
        }





		#endregion
		

	}
}
